Hi all! |
Re: share skip list between triggers Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS |
Re: share skip list between triggers Mathias Mamsch - Thu Jun 17 09:52:05 EDT 2010 Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS These are the triggers that i have created:
Trigger t0 = trigger("installGlobalVariables",
project->module->all->formal,
pre,
open,
0,
"#include <Triggers/_ag_install_global_variables.dxl>")
Trigger t1 = trigger("modPostOpen",
project->module->all->formal,
post,
open,
5,
"#include <Triggers/_ag_store_public_views.dxl>")
Trigger t2 = trigger("modPreClose",
project->module->all->formal,
pre,
close,
5,
"#include <Triggers/_ag_apply_private_views.dxl>")
//Skip list used to prevent the creation of public views not defined in datamodel
noError()
eval_ "ag_gskpPublicViews; return_ \"\""
string notInstalled = lastError()
if (!null notInstalled) evalTop_ ("Skip ag_gskpPublicViews = create()")
string viewName = ""
string strViewFullName = ""
// For all views in the current module...
for viewName in views ( ag_post_open_module ) do
{
// Get the view.
View myView = view (viewName)
if (null myView)
{
// if the handle is null.
continue
}
// If the views is private do nothing... only consider public views for the data model.
if (ag_Function_isPrivateView(myView))
{
continue
}
strViewFullName = name(parentProject)"_"name(ag_post_open_module)"_"viewName""
if (!find(ag_gskpPublicViews,strViewFullName)) put(ag_gskpPublicViews,strViewFullName,strViewFullName)
}
// For all views in the current module...
for viewName in views ( ag_pre_close_module ) do
{
// Get the view.
View myView = view (viewName)
if (null myView)
{
// if the handle is null.
continue
}
// If the views is private do nothing... only consider public views for the data model.
if (ag_Function_isPrivateView(myView))
{
continue
}
strViewFullName = name(parentProject)"_"name(ag_pre_close_module)"_"viewName""
if (find(ag_gskpPublicViews,strViewFullName))
{
delete(ag_gskpPublicViews,strViewFullName)
}
else
{
//load view v
//ViewDef vDef = createPrivate(ag_pre_close_module,true)
//save (myView,vDef)
//save ag_pre_close_module
print strViewFullName"\n"
}
}
|
Re: share skip list between triggers Mathias Mamsch - Thu Jun 17 09:52:05 EDT 2010 Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS These are the triggers that i have created:
Trigger t0 = trigger("installGlobalVariables",
project->module->all->formal,
pre,
open,
0,
"#include <Triggers/_ag_install_global_variables.dxl>")
Trigger t1 = trigger("modPostOpen",
project->module->all->formal,
post,
open,
5,
"#include <Triggers/_ag_store_public_views.dxl>")
Trigger t2 = trigger("modPreClose",
project->module->all->formal,
pre,
close,
5,
"#include <Triggers/_ag_apply_private_views.dxl>")
//Skip list used to prevent the creation of public views not defined in datamodel
noError()
eval_ "ag_gskpPublicViews; return_ \"\""
string notInstalled = lastError()
if (!null notInstalled) evalTop_ ("Skip ag_gskpPublicViews = create()")
string viewName = ""
string strViewFullName = ""
// For all views in the current module...
for viewName in views ( ag_post_open_module ) do
{
// Get the view.
View myView = view (viewName)
if (null myView)
{
// if the handle is null.
continue
}
// If the views is private do nothing... only consider public views for the data model.
if (ag_Function_isPrivateView(myView))
{
continue
}
strViewFullName = name(parentProject)"_"name(ag_post_open_module)"_"viewName""
if (!find(ag_gskpPublicViews,strViewFullName)) put(ag_gskpPublicViews,strViewFullName,strViewFullName)
}
// For all views in the current module...
for viewName in views ( ag_pre_close_module ) do
{
// Get the view.
View myView = view (viewName)
if (null myView)
{
// if the handle is null.
continue
}
// If the views is private do nothing... only consider public views for the data model.
if (ag_Function_isPrivateView(myView))
{
continue
}
strViewFullName = name(parentProject)"_"name(ag_pre_close_module)"_"viewName""
if (find(ag_gskpPublicViews,strViewFullName))
{
delete(ag_gskpPublicViews,strViewFullName)
}
else
{
//load view v
//ViewDef vDef = createPrivate(ag_pre_close_module,true)
//save (myView,vDef)
//save ag_pre_close_module
print strViewFullName"\n"
}
}
|
Re: share skip list between triggers mgomes - Thu Jun 17 11:30:00 EDT 2010 These are the triggers that i have created:
Trigger t0 = trigger("installGlobalVariables",
project->module->all->formal,
pre,
open,
0,
"#include <Triggers/_ag_install_global_variables.dxl>")
Trigger t1 = trigger("modPostOpen",
project->module->all->formal,
post,
open,
5,
"#include <Triggers/_ag_store_public_views.dxl>")
Trigger t2 = trigger("modPreClose",
project->module->all->formal,
pre,
close,
5,
"#include <Triggers/_ag_apply_private_views.dxl>")
//Skip list used to prevent the creation of public views not defined in datamodel
noError()
eval_ "ag_gskpPublicViews; return_ \"\""
string notInstalled = lastError()
if (!null notInstalled) evalTop_ ("Skip ag_gskpPublicViews = create()")
string viewName = ""
string strViewFullName = ""
// For all views in the current module...
for viewName in views ( ag_post_open_module ) do
{
// Get the view.
View myView = view (viewName)
if (null myView)
{
// if the handle is null.
continue
}
// If the views is private do nothing... only consider public views for the data model.
if (ag_Function_isPrivateView(myView))
{
continue
}
strViewFullName = name(parentProject)"_"name(ag_post_open_module)"_"viewName""
if (!find(ag_gskpPublicViews,strViewFullName)) put(ag_gskpPublicViews,strViewFullName,strViewFullName)
}
// For all views in the current module...
for viewName in views ( ag_pre_close_module ) do
{
// Get the view.
View myView = view (viewName)
if (null myView)
{
// if the handle is null.
continue
}
// If the views is private do nothing... only consider public views for the data model.
if (ag_Function_isPrivateView(myView))
{
continue
}
strViewFullName = name(parentProject)"_"name(ag_pre_close_module)"_"viewName""
if (find(ag_gskpPublicViews,strViewFullName))
{
delete(ag_gskpPublicViews,strViewFullName)
}
else
{
//load view v
//ViewDef vDef = createPrivate(ag_pre_close_module,true)
//save (myView,vDef)
//save ag_pre_close_module
print strViewFullName"\n"
}
}
If I apply your code to a test module, but replacing the trigger code of the open triggers by the following, then this works. I would suggest you insert some print statements to see, if there is really something put into the Skip list. Module ag_post_open_module = module current Trigger
// _ag_apply_private_views.dxl print "Apply private Views Trigger\n" int n = -1 string m = "" if (!find(ag_gskpPublicViews, 1, n)) print "1 not found ...\n" if (!find(ag_gskpPublicViews, 2, m)) print "2 not found ...\n" print "n = " n " m = " m "\n"
// _ag_store_public_views.dxl print "Store Public Views Trigger\n" put(ag_gskpPublicViews, 1, 10) put(ag_gskpPublicViews, 2, "a string")
Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS
|
Re: share skip list between triggers Mathias Mamsch - Thu Jun 17 09:52:05 EDT 2010 Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS These are the triggers that i have created:
Trigger t0 = trigger("installGlobalVariables",
project->module->all->formal,
pre,
open,
0,
"#include <Triggers/_ag_install_global_variables.dxl>")
Trigger t1 = trigger("modPostOpen",
project->module->all->formal,
post,
open,
5,
"#include <Triggers/_ag_store_public_views.dxl>")
Trigger t2 = trigger("modPreClose",
project->module->all->formal,
pre,
close,
5,
"#include <Triggers/_ag_apply_private_views.dxl>")
//Skip list used to prevent the creation of public views not defined in datamodel
noError()
eval_ "ag_gskpPublicViews; return_ \"\""
string notInstalled = lastError()
if (!null notInstalled) evalTop_ ("Skip ag_gskpPublicViews = create()")
string viewName = ""
string strViewFullName = ""
// For all views in the current module...
for viewName in views ( ag_post_open_module ) do
{
// Get the view.
View myView = view (viewName)
if (null myView)
{
// if the handle is null.
continue
}
// If the views is private do nothing... only consider public views for the data model.
if (ag_Function_isPrivateView(myView))
{
continue
}
strViewFullName = name(parentProject)"_"name(ag_post_open_module)"_"viewName""
if (!find(ag_gskpPublicViews,strViewFullName)) put(ag_gskpPublicViews,strViewFullName,strViewFullName)
}
// For all views in the current module...
for viewName in views ( ag_pre_close_module ) do
{
// Get the view.
View myView = view (viewName)
if (null myView)
{
// if the handle is null.
continue
}
// If the views is private do nothing... only consider public views for the data model.
if (ag_Function_isPrivateView(myView))
{
continue
}
strViewFullName = name(parentProject)"_"name(ag_pre_close_module)"_"viewName""
if (find(ag_gskpPublicViews,strViewFullName))
{
delete(ag_gskpPublicViews,strViewFullName)
}
else
{
//load view v
//ViewDef vDef = createPrivate(ag_pre_close_module,true)
//save (myView,vDef)
//save ag_pre_close_module
print strViewFullName"\n"
}
}
|
Re: share skip list between triggers mgomes - Thu Jun 17 12:48:08 EDT 2010 These are the triggers that i have created:
Trigger t0 = trigger("installGlobalVariables",
project->module->all->formal,
pre,
open,
0,
"#include <Triggers/_ag_install_global_variables.dxl>")
Trigger t1 = trigger("modPostOpen",
project->module->all->formal,
post,
open,
5,
"#include <Triggers/_ag_store_public_views.dxl>")
Trigger t2 = trigger("modPreClose",
project->module->all->formal,
pre,
close,
5,
"#include <Triggers/_ag_apply_private_views.dxl>")
//Skip list used to prevent the creation of public views not defined in datamodel
noError()
eval_ "ag_gskpPublicViews; return_ \"\""
string notInstalled = lastError()
if (!null notInstalled) evalTop_ ("Skip ag_gskpPublicViews = create()")
string viewName = ""
string strViewFullName = ""
// For all views in the current module...
for viewName in views ( ag_post_open_module ) do
{
// Get the view.
View myView = view (viewName)
if (null myView)
{
// if the handle is null.
continue
}
// If the views is private do nothing... only consider public views for the data model.
if (ag_Function_isPrivateView(myView))
{
continue
}
strViewFullName = name(parentProject)"_"name(ag_post_open_module)"_"viewName""
if (!find(ag_gskpPublicViews,strViewFullName)) put(ag_gskpPublicViews,strViewFullName,strViewFullName)
}
// For all views in the current module...
for viewName in views ( ag_pre_close_module ) do
{
// Get the view.
View myView = view (viewName)
if (null myView)
{
// if the handle is null.
continue
}
// If the views is private do nothing... only consider public views for the data model.
if (ag_Function_isPrivateView(myView))
{
continue
}
strViewFullName = name(parentProject)"_"name(ag_pre_close_module)"_"viewName""
if (find(ag_gskpPublicViews,strViewFullName))
{
delete(ag_gskpPublicViews,strViewFullName)
}
else
{
//load view v
//ViewDef vDef = createPrivate(ag_pre_close_module,true)
//save (myView,vDef)
//save ag_pre_close_module
print strViewFullName"\n"
}
}
It could have a lot of reasons why you don't get any value in the skip: a) your module handle is bs -> you did not post the part of the code where you acquire the module handle, so I cannot tell b) Your ag_Function_isPrivateView is bs -> if it returns true always you will not have anything in the skips -> but you did not post the code c) your current module is somehow not equal to the trigger module, therefore your view() call gives you nothing -> oh wait! You did not post the relevant code. So how should anyone tell what is going wrong in your code?? Regards, Mathias Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS |
Re: share skip list between triggers Mathias Mamsch - Thu Jun 17 12:25:28 EDT 2010
If I apply your code to a test module, but replacing the trigger code of the open triggers by the following, then this works. I would suggest you insert some print statements to see, if there is really something put into the Skip list. Module ag_post_open_module = module current Trigger
// _ag_apply_private_views.dxl print "Apply private Views Trigger\n" int n = -1 string m = "" if (!find(ag_gskpPublicViews, 1, n)) print "1 not found ...\n" if (!find(ag_gskpPublicViews, 2, m)) print "2 not found ...\n" print "n = " n " m = " m "\n"
// _ag_store_public_views.dxl print "Store Public Views Trigger\n" put(ag_gskpPublicViews, 1, 10) put(ag_gskpPublicViews, 2, "a string")
Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS
I found my error. Since i'm using a string variable to insert the values to the skip list, that string must be also global or else when the trigger is ended it will lose all the values. Thanks a lot for help me finding a solution, i'm trying to implement this in the last 3 days... next time i will ask for help here sooner... One more time thanks |
Re: share skip list between triggers Mathias Mamsch - Thu Jun 17 16:11:27 EDT 2010 Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS |
Re: share skip list between triggers mgomes - Thu Jun 17 18:04:45 EDT 2010 Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS |
Re: share skip list between triggers Mathias Mamsch - Thu Jun 17 18:45:52 EDT 2010 Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS The code that works is below:
file: _ag_install_global_variables.dxl
//Skip list used to prevent the creation of public views not defined in datamodel
noError()
eval_ "ag_gskpPublicViews; return_ \"\""
string notInstalled = lastError()
if (!null notInstalled)
{
evalTop_ ("Skip ag_gskpPublicViews = create()")
evalTop_ ("string ag_gstrViewFullName = \"\"")
}
file: _ag_store_public_views.dxl
Module ag_post_open_module = module current Trigger
Project parentProject = getParentProject(ag_post_open_module)
string viewName = ""
// For all views in the current module...
for viewName in views ( ag_post_open_module ) do
{
// Get the view.
View myView = view (viewName)
if (null myView)
{
// if the handle is null.
continue
}
ag_gstrViewFullName= name(parentProject)"_"name(ag_post_open_module)"_"viewName
// If the views is private do nothing... only consider public views for the data model.
if (ag_Function_isPrivateView(myView))
{
if (find(ag_gskpPublicViews, ag_gstrViewFullName))
{
delete(ag_gskpPublicViews,ag_gstrViewFullName)
}
}
else
{
if (!find (ag_gskpPublicViews, ag_gstrViewFullName))
{
put(ag_gskpPublicViews,ag_gstrViewFullName,ag_gstrViewFullName)
}
}
}
file: _ag_apply_private_views.dxl
Module ag_pre_close_module = module current Trigger
Project parentProject = getParentProject(ag_pre_close_module)
string viewName = ""
// For all views in the current module...
for viewName in views ( ag_pre_close_module ) do
{
// Get the view.
View myView = view (viewName)
if (null myView)
{
// if the handle is null.
continue
}
// If the views is private do nothing... only consider public views for the data model.
if (ag_Function_isPrivateView(myView))
{
continue
}
ag_gstrViewFullName = name(parentProject)"_"name(ag_pre_close_module)"_"viewName
if (find(ag_gskpPublicViews,ag_gstrViewFullName))
{
delete(ag_gskpPublicViews,ag_gstrViewFullName)
}
else
{
load view viewName
ViewDef vDef = createPrivate(ag_pre_close_module,true)
save (myView,vDef)
save ag_pre_close_module
}
}
|